//添加网络请求

//引入封装的axios
import request from "../util/request";
//引入url封装的js
import { API_24H, API_7D, KEY, API_GEO_CITY, API_Now, API_AIR, API_Indices, API_Indices3d } from "./urlApi";

//未来24小时天气预报请求
//函数表达式
export const fetch24HourData = (locationID) => {
    return request.get(API_24H, {
        params: {
            location: locationID,
            key: KEY,
        }
    })
}

//未来7日天气预报请求
//函数表达式
export const fetch7DayData = (locationID) => {
    return request.get(API_7D, {
        params: {
            location: locationID,
            key: KEY,
        }
    })
}
//和风天气城市搜索请求
export const fetchCityData = (cityName) => {
    return request.get(API_GEO_CITY, {
        params: {
            location: cityName,
            key: KEY,
        }
    })
}
//实时天气请求
export const fetchNowData = (locationID) => {
    return request.get(API_Now, {
        params: {
            location: locationID,
            key: KEY,
        }
    })
}

//空气质量请求
export const fetchAirData = (locationID) => {
    return request.get(API_AIR, {
        params: {
            location: locationID,
            key: KEY,
        }
    })
}

//生活指数请求
export const fetchIndicesData = (locationID, type) => {
    return request.get(API_Indices, {
        params: {
            location: locationID,
            key: KEY,
            type: type,
        }
    })
}

//未来三天生活指数请求
export const fetchIndices3dData = (locationID, type) => {
    return request.get(API_Indices3d, {
        params: {
            location: locationID,
            key: KEY,
            type: type,
        }
    })
}

//export {fetch24HourData,fetch7DayData}